<?php class Equal_Service extends CWidget{
     public function init(){
        
    }
    public function Equal_Service(){
         $arrTag = explode(",",Services::getTypeJob($_GET['id']));
        $criteria = new CDbCriteria;
        $criteria->order ="id DESC";
        //
        $criteria->addSearchCondition('servicetype',Services::getTypeJob($_GET['id']), true, 'AND');
        //$criteria->condition = 'id !='.$_GET['id'];
        $criteria->addSearchCondition('id',$_GET['id'], false, 'AND');
        foreach($arrTag as $tag){
                 $criteria->addSearchCondition('keyword',$tag, true, 'OR');
        }
        $criteria->limit = 5;
        $count = Service::model()->count($criteria);
        $pages = new CPagination($count);
        $pages->pageSize = 5;
        $pages->applyLimit($criteria);
        
        $model = Service::model()->findAll($criteria);
        $this->render('equal_service',array('model'=>$model,'pages'=>$pages));
    }
    
}

?>